package com.sg.business.commons.labelprovider.project;

import com.mongodb.DBObject;
import com.sg.business.model.WorkOrderDetail;
import com.sg.widgets.commons.labelprovider.ConfiguratorColumnLabelProvider;

public abstract class AbstractProjectWorkOrderLabelProvider extends
		ConfiguratorColumnLabelProvider {

	@Override
	public String getText(Object element) {
		if (element instanceof WorkOrderDetail) {
			WorkOrderDetail workOrderDetail = (WorkOrderDetail) element;
			Object value = workOrderDetail.getValue(getFieldName());
			if (value instanceof DBObject) {
				DBObject dbo = (DBObject) value;
				return getTextValue(dbo);
			}
		}
		return "";
	}

	protected abstract String getTextValue(DBObject dbo);

}
